package br.ufrn.opencopi.graph;

/**
 * Each EdgeTuple represents a edge between two vertexs. The edge's direction is unidirectional from
 * vertexIn to vertexOut.
 *
 * @author fredlopes
 */
public class EdgeTuple {

	private Vertex vertexIn;

	private Vertex vertexOut;

	public EdgeTuple() {
		super();
	}

	public EdgeTuple(Vertex vertexOut, Vertex vertexIn) {
		super();
		this.vertexIn = vertexIn;
		this.vertexOut = vertexOut;
	}

	public Vertex getVertexIn() {
		return vertexIn;
	}

	public void setVertexIn(Vertex vertexIn) {
		this.vertexIn = vertexIn;
	}

	public Vertex getVertexOut() {
		return vertexOut;
	}

	public void setVertexOut(Vertex vertexOut) {
		this.vertexOut = vertexOut;
	}

	/**
	 * This method returns '1' in case of the vertexIn is equal to parameter, returns '2' in case of the
	 * vertexOut is equal to parameter or returns '0' in case of the parameter is not used in this vertex.
	 * @param v
	 * @return
	 */
	public int hasVertex(Vertex v){
		if(v.equals(vertexIn))
			return 1;
		if(v.equals(vertexOut))
			return 2;
		return 0;
	}

}
